/**
 * Class: PLayer
 *
 * Purpose: 
 *
 * Created: Jan 22, 2010 @ 11:24:35 AM
 * @author Ken Scott
 */
package org.openfantasia.ui;

import java.util.ArrayList;

public class PLayer extends ArrayList<PComponent> {

	private PComponent container;


	private PLayer() {
	}


	public PLayer(PComponent container) {
		this.container = container;
	}


	public void setup() {
		for (PComponent t : this) {
			t.setup();
		}
	}


	public void draw() {
		for (PComponent t : this) {
			t.draw();
		}
	}


	public boolean add(PComponent component) {
			component.setContainer(container);
			return super.add(component);
	}


	public boolean remove(PComponent component) {
		component.setContainer(null);
		return super.remove(component);
	}
}
